home *** CD-ROM | disk | FTP | other *** search
- /************************************************************************************
- *
- * Project Name: Templates
- * File Name: fset.c
- * Author: Rob Neville (IIx)
- * Date: May 18, 1989
- *
- * Description: Template fset function.
- *
- *************************************************************************************
- *
- * Revision History:
- * 5/18/89 - Original version by Rob Neville (IIx)
- * 6/26/89 - rev'd for b2 of Toolbox
- *
- ************************************************************************************/
-
- #include "FTTool.h"
-
- pascal long FSET(pSetup,msg,p1,p2,p3)
- FTSetupPtr pSetup;
- short msg;
- long p1,p2,p3;
- {
- long theErr = noErr;
- long ToolDoPreflight();
- long ToolDoFilter();
- void ToolDoItem();
- void ToolDoSetup();
- void ToolDoCleanup();
-
- switch (msg)
- {
- case XpreflightMsg:
- theErr = ToolDoPreflight(pSetup);
- break;
- case XsetupMsg:
- ToolDoSetup(pSetup);
- break;
- case XitemMsg:
- ToolDoItem(pSetup,p1);
- break;
- case XfilterMsg:
- theErr = ToolDoFilter(pSetup,p1,p2);
- break;
- case XcleanupMsg:
- ToolDoCleanup(pSetup);
- break;
- }
- return (theErr);
- #pragma unused (p3)
- }
-
-
- void ToolDoSetup(pSetup)
- FTSetupPtr pSetup;
- {
- DialogPtr theDialog;
- ConfigPtr pConfig;
- short theKind;
- Handle theHandle;
- Rect theRect;
- short count;
-
- pConfig = (ConfigPtr)pSetup->theConfig;
- theDialog = pSetup->theDialog;
- count = pSetup->count - 1;
-
- GetDItem(theDialog,count + ByronItem,&theKind,&theHandle,&theRect);
- SetCtlValue( (ControlHandle)theHandle,pConfig->param1 ? 1 : 0);
- GetDItem(theDialog,count + RobItem,&theKind,&theHandle,&theRect);
- SetCtlValue((ControlHandle)theHandle,pConfig->param2 ? 1 : 0);
- }
-
- void ToolDoItem(setupP, itemPtr)
- FTSetupPtr setupP;
- short *itemPtr;
- {
- short theItem;
- short theKind;
- Handle theHandle;
- Rect theRect;
- ConfigPtr pConfig;
- DialogPtr theDialog;
- long first;
- short theValue;
-
- pConfig = (ConfigPtr)setupP->theConfig;
- theDialog = setupP->theDialog;
- first = setupP->count - 1;
- theItem = *itemPtr;
- GetDItem(theDialog, theItem, &theKind, &theHandle, &theRect);
- theItem = *itemPtr - first;
- switch (theItem)
- {
- case ByronItem:
- theValue = GetCtlValue((ControlHandle)theHandle);
- SetCtlValue((ControlHandle)theHandle,theValue ^ 1);
- pConfig->param1 = theValue ^ 1;
- break;
- case RobItem:
- theValue = GetCtlValue((ControlHandle)theHandle);
- SetCtlValue((ControlHandle)theHandle, theValue ^ 1);
- pConfig->param2 = theValue ^ 1;
- break;
- default:
- break;
- }
- }
-
- long ToolDoFilter(setupP, theEvent, itemPtr)
- FTSetupPtr setupP;
- EventRecord *theEvent;
- short *itemPtr;
- {
- #pragma unused (setupP)
- #pragma unused (theEvent)
- #pragma unused (itemPtr)
- return(0); /* I don't have any special items just check boxes */
- }
-
- void ToolDoCleanup(setupP)
- FTSetupPtr setupP;
- {
- #pragma unused (setupP) /* I don't do anything */
- }
-
-
- long ToolDoPreflight(setupP)
- FTSetupPtr setupP;
- {
- short id;
- Handle theHandle;
-
- id = CRMLocalToRealID(classFT,(*setupP).procID,'DITL',1);
- if (id == -1)
- return (nil);
- theHandle = GetResource('DITL',id);
- if (theHandle != nil)
- DetachResource(theHandle);
- return ((long)theHandle);
- }